#include <gtest/gtest.h>
#include <base/Foo.h>

struct Test8 : ::testing::Test
{
    virtual void SetUp() override
    {
		::memset(buff, 0, MAX_BUFF_SIZE*sizeof(unsigned char));
    }

    bool assert_0_to_10_is_ff() const
    {
        for(int i = 0;i<=10;i++)
        {
            if(buff[i]  != 0xff) return false;
        }
        return true;
    }

    bool assert_11_to_99_is_0() const
    {
        for(int i = 11; i< MAX_BUFF_SIZE ;i++)
        {
            if(buff[i]  != 0) return false;
        }
        return true;
    }

    Foo* getBuff() const
    {
        return (Foo*)buff;
    }
private:
	enum {MAX_BUFF_SIZE = 100 };
    unsigned char buff[MAX_BUFF_SIZE];
};

extern void set0xff(Foo* p);

TEST_F(Test8, set_0_to_10_ff)
{
    Foo* p = getBuff();
    set0xff(p);

    ASSERT_TRUE(assert_0_to_10_is_ff());
    ASSERT_TRUE(assert_11_to_99_is_0());
}


